
const cloud = require('wx-server-sdk')

cloud.init()

let db = cloud.database()

exports.main = async (event, context) => {
  return await db.collection('userInfo')
    .where({
      _id: event._id
    })
    .update({
      data: {
        credit:event.credit
      }
    })
}